package com.whmskj.xjlhsc.qianYiData.service.impl;

import com.whmskj.xjlhsc.qianYiData.mapper.DailyPowerSupplyMapper;
import com.whmskj.xjlhsc.qianYiData.service.DailyPowerSupplyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDate;

@Service
public class DailyPowerSupplyServiceImpl implements DailyPowerSupplyService {

    @Resource
    private DailyPowerSupplyMapper mapper;

    @Override
    public int syncDay(LocalDate day) {
        if (day == null) day = LocalDate.now();
        int updated = mapper.updateFromEnergy(day);
        int inserted = mapper.insertMissingFromEnergy(day);
        return updated + inserted;
    }
}

